//
//  SideBarViewController.m
//  GolfFriend
//
//  Created by Vescky on 13-11-26.
//  Copyright (c) 2013年 vescky.org. All rights reserved.
//

#import "SideBarViewController.h"
#import "AppDelegate.h"

@interface SideBarViewController ()

@end

@implementation SideBarViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self.view setBackgroundColor:GetColorWithRGB(72, 182, 159)];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Public
- (IBAction)btnAction:(id)sender {
    UIButton *btn = (UIButton*)sender;
    NSString *classString,*webappLink,*vTitle;
    if (btn.tag == 101) {
        //活动资讯
        classString = @"NewsListViewController";
    }
    else if (btn.tag == 102) {
        //球场推荐
        classString = @"NearbyStadiumList";
    }
    else if (btn.tag == 103) {
        //附近球友
        classString = @"NearbyFriendsViewController";
    }
    else if (btn.tag == 104) {
        //约TA打球
        classString = @"WebappBrowserViewController";
        webappLink = @"http://golffriend.sinaapp.com/test/webveiw/yueqiu.html";
        vTitle = @"约TA打球";
    }
    else if (btn.tag == 105) {
        //下载图片
        classString = @"Download12PhotosViewController";
    }
    else if (btn.tag == 106) {
        //教练推荐
        classString = @"WebappBrowserViewController";
        webappLink = @"http://golffriend.sinaapp.com/test/webveiw/jiaolian.html";
        vTitle = @"教练推荐";
    }
    
    id obj = NSClassFromString(classString);
    UIViewController *vc = [[obj alloc] init];
    
    if ([vc respondsToSelector:@selector(setWebappLink:)]) {
        [vc performSelector:@selector(setWebappLink:) withObject:webappLink];
        [vc setTitle:vTitle];
    }
    
    [[APP_DELEGATE navigationController] pushViewController:vc animated:YES];
    
    
    
}

@end
